package model.forview;

import java.util.ArrayList;

import model.wrap.node.Node;
import model.wrap.user.User;
import models.ConstantName;
import models.ConstantValue;

public class UserModelForView extends ContentForMainTemplate
{
    private User user;

    private String firstName;
    private String lastName;
    private String userName;

    public UserModelForView(User user)
    {
	this.user = user;
	firstName = this.user.getFirstName();
	lastName = this.user.getLastName();
	userName = this.user.getEmail();
	setDefaultValues();
    }

    protected void setDefaultValues()
    {
	String title = ConstantValue.getConstantValue(ConstantName.NODE_CREATE_PAGE_TITLE);
	String header = ConstantValue.getConstantValue(ConstantName.NODE_CREATE_PAGE_HEADER);
	String footer = ConstantValue.getConstantValue(ConstantName.NODE_CREATE_PAGE_FOOTER);
	String userName = "";

	title = title != null ? title : "Информация о пользователе";
	header = header != null ? header : "Информация о пользователе";
	footer = footer != null ? footer : "Информация о пользователе";

	mainModelForView = new MainModelForView(title, userName, header, footer);
    }

    public User getUser()
    {
	return user;
    }

    public void setUser(User user)
    {
	this.user = user;
    }

    public String getFirstName()
    {
	return firstName;
    }

    public void setFirstName(String firstName)
    {
	this.firstName = firstName;
    }

    public String getLastName()
    {
	return lastName;
    }

    public void setLastName(String lastName)
    {
	this.lastName = lastName;
    }

    public String getUserName()
    {
	return userName;
    }

    public void setUserName(String userName)
    {
	this.userName = userName;
    }
    
    public int getUserNodesSize()
    {
	ArrayList<Node> nodes = Node.getAllUsersNodes(this.user);
	return nodes.size();
    }
    
}
